package com.mikgonz.farkle.shared;

import java.util.List;

import com.google.web.bindery.requestfactory.shared.Request;
import com.google.web.bindery.requestfactory.shared.RequestContext;
import com.google.web.bindery.requestfactory.shared.RequestFactory;
import com.google.web.bindery.requestfactory.shared.ServiceName;


public interface FarkleRequestFactory extends RequestFactory {

        public static final String NEW_FRIEND_REQUEST_ACTION = "com.mikgonz.farkle.NEW_REQUEST_ACTION";
        public static final String FRIEND_REQUEST_ACCEPTED_ACTION = "com.mikgonz.farkle.REQUEST_ACCEPTED_ACTION";
        public static final String FRIEND_REQUEST_REJECTED_ACTION = "com.mikgonz.farkle.REQUEST_REJECTED_ACTION";
        public static final String NEW_MSG_ACTION = "com.mikgonz.farkle.NEW_MSG_ACTION";

        FriendshipRequest friendshipRequest();

        @ServiceName("com.mikgonz.farkle.server.FarkleService")
        public interface FriendshipRequest extends RequestContext {

                Request<FriendshipProxy> createFriendship();

                Request<FriendshipProxy> readFriendship(Long id);

                Request<FriendshipProxy> updateFriendship(FriendshipProxy friendship);

                Request<Void> deleteFriendship(FriendshipProxy friendship);

                Request<List<FriendshipProxy>> queryFriendshipsByString(String username);

                Request<List<FriendshipProxy>> queryFriendshipsByLong(Long id);

                Request<FriendshipProxy> startFriendship(String originalName,
                                Long originalId, String otherName);

                Request<UserProxy> acceptOrRejectFriendship(Long id, boolean accept);

        }
        
        UserRequest userRequest();
        
        @ServiceName("com.mikgonz.farkle.server.FarkleService")
        public interface UserRequest extends RequestContext {

                Request<UserProxy> createUser();

                Request<UserProxy> readUser(Long id);

                Request<UserProxy> updateUser(UserProxy user);

                Request<Void> deleteUser(UserProxy user);

                Request<UserProxy> logIn(String username, String password, Long id,
                                String xtifyKey);

                Request<UserProxy> register(String username, String password,
                                String xtifyKey);
                
                Request<String> checkAvailability(String username);

        }
        
        ChatRequest chatRequest();
        
        @ServiceName("com.mikgonz.farkle.server.FarkleService")
        public interface ChatRequest extends RequestContext {
                
                Request<Void> sendChatMessage(Long fromId, Long toId, String body);

        }

}
